aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/+layout.svelte
blob: dd29e3aae46d1869c4d6ccf91b349dcadb652a0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<script>
  import AppHeader from "$comp/AppHeader.svelte";
  import { onNavigate } from "$app/navigation";
  export let data;

  onNavigate((navigation) => {
    if (!document.startViewTransition) return;

    return new Promise((resolve) => {
      document.startViewTransition(async () => {
        resolve();
        await navigation.complete;
      });
    });
  });
</script>

<AppHeader {data} />
<div class="content">
  <slot />
</div>

<style>
  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }

  @keyframes fade-out {
    to {
      opacity: 0;
    }
  }

  @keyframes slide-from-right {
    from {
      transform: translateX(60px);
    }
  }

  @keyframes slide-to-left {
    to {
      transform: translateX(-60px);
    }
  }

  :root::view-transition-old(root) {
    animation: 280ms cubic-bezier(0.4, 0, 1, 1) both fade-out,
      180ms cubic-bezier(0.4, 0, 0.2, 1) both slide-to-left;
  }

  :root::view-transition-new(root) {
    animation: 280ms cubic-bezier(0, 0, 0.2, 1) 80ms both fade-in,
      180ms cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right;
  }
</style>